package constant

import (
	"gin/common"
	"gin/common/constant"
	util2 "gin/common/util"
	"github.com/gin-gonic/gin"
	"os"
)

/**
 * 代码生成通用常量
 *
 * @author wangwei
 * @date 2024-11-28 10:37:00
 */

const TYPE_STRING = "String"

var COLUMNTYPE_STR = []string{"char", "varchar", "nvarchar", "varchar2"}

/** 数据库文本类型 */
var COLUMNTYPE_TEXT = []string{"tinytext", "text", "mediumtext", "longtext"}

/** 数据库时间类型 */
var COLUMNTYPE_TIME = []string{"datetime", "time", "date", "timestamp"}

/** 数据库数字类型 */
var COLUMNTYPE_NUMBER = []string{"tinyint", "smallint", "mediumint", "int", "number", "integer",
	"bit", "bigint", "float", "double", "decimal"}

/** 页面不需要编辑字段 */
var COLUMNNAME_NOT_EDIT = []string{"id", "create_by", "create_time", "del_flag"}

/** 页面不需要显示的列表字段 */
var COLUMNNAME_NOT_LIST = []string{"id", "create_by", "create_time", "del_flag", "update_by",
	"update_time"}

/** 页面不需要查询字段 */
var COLUMNNAME_NOT_QUERY = []string{"id", "create_by", "create_time", "del_flag", "update_by",
	"update_time", "remark"}

/** 文本域 */
var HTML_TEXTAREA = "textarea"

/** 文本框 */
var HTML_INPUT = "input"

/** 单选框 */
var HTML_RADIO = "radio"

/** 时间类型 */
var TYPE_DATE = "Date"

/** 日期控件 */
var HTML_DATETIME = "datetime"

/** 下拉框 */
var HTML_SELECT = "select"

/** 图片上传控件 */
var HTML_IMAGE_UPLOAD = "imageUpload"

/** 文件上传控件 */
var HTML_FILE_UPLOAD = "fileUpload"

/** 富文本控件 */
var HTML_EDITOR = "editor"

/** 高精度计算类型 */
var TYPE_BIGDECIMAL = "BigDecimal"

/** 整型 */
var TYPE_INTEGER = "Integer"

/** 长整型 */
var TYPE_LONG = "Long"

/** 模糊查询 */
var QUERY_LIKE = "LIKE"

/** 需要 */
var REQUIRE = "1"

func GenTempPath() string {
	var path = "F:/技术栈/golang/golang-mysql/"
	return path
}

//代码生成---具体业务层模块名称
func TempModePath() string {
	var modeName = "generator/"
	return modeName
}

//代码生成---具体业务层模版文件目录配置
func TemplatePath(mode string) string {
	var tempPath string = "vm/" + mode + ".txt"
	return tempPath
}

//获取系统当前运行的路径
func Pwd(c *gin.Context) string {
	cur, err := os.Getwd()
	if err != nil {
		common.ReturnError(c, constant.ERRORCODE(), "获取系统当前运行目录出错,错误信息为："+util2.MapToJson(err), "", int64(len("")))
	}
	return cur
}

/*func Contains(str, subStr string) bool {
	return strings.Contains(str, subStr)
}*/

